<template>
    <div class="container">
        <div class="row justify-content-center pt-1">
            <div class="col-md-6 p-3">
<!--            用v-model绑定这个值-->
                <input type="hidden" name="team" value="1" ref="team1">
<!--            ref相当于给这个dom赋个名字？差的不多这样，通过$refs.name就获取到这个dom-->
                <button value="1" class="btn btn-primary" @click="changeScore">增加</button>
                <button value="0" class="btn btn-primary" @click="changeScore">减少</button>
            </div>
            <div class="col-md-6 p-3">
                <input type="hidden" name="team" value="2" ref="team2">
                <button value="1" class="btn btn-warning" @click="changeScore2">增加</button>
                <button value="0" class="btn btn-warning" @click="changeScore2">减少</button>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    methods: {
        changeScore(event) {
            questScore(this.$refs.team1.value, event.currentTarget.value)
        },
        changeScore2(event) {
            questScore(this.$refs.team2.value, event.currentTarget.value)
        }
    }
}
function questScore(team, type)
{
    axios.post('/score', {team: team, type: type}).then(res => {
    }).catch(e => {
        console.log(e)
    });
}
</script>
